home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: pixmap.tcl,v 1.4 1995/02/13 14:23:58 zibi Exp $
- #
- # allows browsing of a pixmap directory
- #
-
- source tools.tcl
-
- global pDir
- global lst
-
- proc selectCB {parent cbs} {
- global pDir
- global icon icon2 icon3
-
- set file "$pDir/[keylget cbs selectedItemList]"
- echo "File is " $file "\n"
-
- if {! [info exists icon]} {
- set fn [VtFormDialog $parent.picture -modeless \
- -wmDecoration {TITLE BORDER} ]
- VtLabel $fn.Label -labelCenter -leftSide FORM -rightSide FORM
- set icon [VtLabel $fn.icon -pixmap $file]
- VtLabel $fn.Pixmap -labelCenter -leftSide FORM -rightSide FORM
- set icon2 [VtPushButton $fn.icon2 -pixmap $file ]
- VtLabel $fn.ip \
- -label "Insensitive Pixmap" \
- -labelCenter -leftSide FORM -rightSide FORM
- set icon3 [VtPushButton $fn.icon3 -pixmap $file -sensitive 0]
- VtManage $fn
- }
-
- VtSetValues $icon -pixmap $file
- VtSetValues $icon2 -pixmap $file
- VtSetValues $icon3 -pixmap $file
- }
-
- proc setPDirCB {cbs} {
- global pDir
- global lst
-
- set dir [keylget cbs value]
- echo "Dir is " $dir "\n"
-
- set ret [catch {cd $dir} errMsg]
- if {$ret != 0} {
- echo "\n\nError: $errMsg\n"
- return
- }
- set pDir $dir
- set files [glob *]
-
- VtSetValues $lst -itemList $files
- }
-
- if { [file isdirectory /usr/include/X11/bitmaps/xdt_p_large] } {
- set pDir "/usr/include/X11/bitmaps/xdt_p_large"
- #set pDir "/u/gko/X11/WidgetServer/ms/wstcl/tests"
- } else {
- set pDir [pwd]
- }
-
- set ap [VtOpen pixmaps]
-
- set fn [VtFormDialog $ap.form -okLabel Exit -okCallback QuitCB ]
-
- VtLabel $fn.lab -label "Directory to browse"
-
- VtText $fn.txt -value $pDir -columns 50 -callback setPDirCB
-
- cd $pDir
- set files [glob *.px]
-
- set lst [VtList $fn.list \
- -itemList "$files" \
- -rows 8\
- -callback "selectCB $fn" \
- -leftOffset 6 -leftSide FORM \
- -rightSide FORM \
- -topOffset 5 -bottomSide FORM ]
-
- VtShow $fn
-
- VtMainLoop
-